package openase.audiosearch.comm.request.encoder.facade;

import java.nio.ByteBuffer;

import openase.audiosearch.comm.request.Request;
import openase.audiosearch.comm.request.encoder.RequestEncoder;
import openase.audiosearch.comm.request.encoder.factory.RequestEncoderFactory;


public abstract class RequestEncoderFacade {

	public static ByteBuffer encode(Request request) {
		RequestEncoder<Request> encoder = RequestEncoderFactory.getEncoder(request);
		if (encoder == null) {
			throw new IllegalArgumentException("No encoder found for request: " + request);
		}
		return encoder.encode(request);
	}

}
